fix: remove xmodulemixin and accept other legacy mxins#230
Open
irtazaakram wants to merge 2 commits intomainfrom
Open
fix: remove xmodulemixin and accept other legacy mxins#230irtazaakram wants to merge 2 commits intomainfrom
irtazaakram wants to merge 2 commits intomainfrom
Conversation
ee7d360 to
a21bafa
Compare
Contributor
|
Code is crashing on the following test sceneario, it's working fine on the master/main branch. 2026-04-10 11:40:57,493 INFO 27 [edx_rest_framework_extensions.auth.jwt.middleware] [user 4] [ip 172.18.0.1] middleware.py:79 - ('The view BlockFieldsView allows Jwt Authentication. The required permission class, NotJwtRestrictedApplication,', ' was automatically added.')
2026-04-10 11:40:57,509 WARNING 27 [py.warnings] [user 4] [ip 172.18.0.1] warnings.py:112 - /openedx/edx-platform/openedx/core/djangoapps/xblock/runtime/runtime.py:148: UserIdDeprecationWarning: Runtime.user_id is deprecated
self.user_id = self.user.id
2026-04-10 11:40:57,521 ERROR 27 [root] [user None] [ip None] signals.py:22 - Uncaught exception from None
Traceback (most recent call last):
File "/openedx/venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/pyenv/versions/3.12.12/lib/python3.12/contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/rest_framework/views.py", line 515, in dispatch
response = self.handle_exception(exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/rest_framework/views.py", line 475, in handle_exception
self.raise_uncaught_exception(exc)
File "/openedx/venv/lib/python3.12/site-packages/rest_framework/views.py", line 486, in raise_uncaught_exception
raise exc
File "/openedx/venv/lib/python3.12/site-packages/rest_framework/views.py", line 512, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/pyenv/versions/3.12.12/lib/python3.12/contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/openedx/edx-platform/openedx/core/djangoapps/xblock/rest_api/views.py", line 345, in post
block.editor_saved(user, old_metadata, old_content)
File "/mnt/xblocks-contrib/xblocks_contrib/video/video.py", line 584, in editor_saved
video_config_service.handle_editor_saved(self, user.id, old_metadata)
File "/openedx/edx-platform/openedx/core/djangoapps/video_config/services.py", line 314, in handle_editor_saved
metadata_was_changed_by_user = old_metadata != own_metadata(video_block)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/edx-platform/xmodule/modulestore/inheritance.py", line 340, in own_metadata
return block.get_explicitly_set_fields_by_scope(Scope.settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'VideoBlockWithMixins' object has no attribute 'get_explicitly_set_fields_by_scope'
Internal Server Error: /api/xblock/v2/xblocks/lb:axim:1:video:848a25e5-b803-4e84-b4bc-23daf842e3f8/fields/
Traceback (most recent call last):
File "/openedx/venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/pyenv/versions/3.12.12/lib/python3.12/contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/rest_framework/views.py", line 515, in dispatch
response = self.handle_exception(exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/rest_framework/views.py", line 475, in handle_exception
self.raise_uncaught_exception(exc)
File "/openedx/venv/lib/python3.12/site-packages/rest_framework/views.py", line 486, in raise_uncaught_exception
raise exc
File "/openedx/venv/lib/python3.12/site-packages/rest_framework/views.py", line 512, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/pyenv/versions/3.12.12/lib/python3.12/contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/openedx/edx-platform/openedx/core/djangoapps/xblock/rest_api/views.py", line 345, in post
block.editor_saved(user, old_metadata, old_content)
File "/mnt/xblocks-contrib/xblocks_contrib/video/video.py", line 584, in editor_saved
video_config_service.handle_editor_saved(self, user.id, old_metadata)
File "/openedx/edx-platform/openedx/core/djangoapps/video_config/services.py", line 314, in handle_editor_saved
metadata_was_changed_by_user = old_metadata != own_metadata(video_block)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/edx-platform/xmodule/modulestore/inheritance.py", line 340, in own_metadata
return block.get_explicitly_set_fields_by_scope(Scope.settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'VideoBlockWithMixins' object has no attribute 'get_explicitly_set_fields_by_scope'
2026-04-10 11:40:57,624 ERROR 27 [django.request] [user None] [ip None] log.py:253 - Internal Server Error: /api/xblock/v2/xblocks/lb:axim:1:video:848a25e5-b803-4e84-b4bc-23daf842e3f8/fields/
Traceback (most recent call last):
File "/openedx/venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/pyenv/versions/3.12.12/lib/python3.12/contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/rest_framework/views.py", line 515, in dispatch
response = self.handle_exception(exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.12/site-packages/rest_framework/views.py", line 475, in handle_exception
self.raise_uncaught_exception(exc)
File "/openedx/venv/lib/python3.12/site-packages/rest_framework/views.py", line 486, in raise_uncaught_exception
raise exc
File "/openedx/venv/lib/python3.12/site-packages/rest_framework/views.py", line 512, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/pyenv/versions/3.12.12/lib/python3.12/contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/openedx/edx-platform/openedx/core/djangoapps/xblock/rest_api/views.py", line 345, in post
block.editor_saved(user, old_metadata, old_content)
File "/mnt/xblocks-contrib/xblocks_contrib/video/video.py", line 584, in editor_saved
video_config_service.handle_editor_saved(self, user.id, old_metadata)
File "/openedx/edx-platform/openedx/core/djangoapps/video_config/services.py", line 314, in handle_editor_saved
metadata_was_changed_by_user = old_metadata != own_metadata(video_block)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/edx-platform/xmodule/modulestore/inheritance.py", line 340, in own_metadata
return block.get_explicitly_set_fields_by_scope(Scope.settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'VideoBlockWithMixins' object has no attribute 'get_explicitly_set_fields_by_scope'
[10/Apr/2026 11:40:57] "POST /api/xblock/v2/xblocks/lb:axim:1:video:848a25e5-b803-4e84-b4bc-23daf842e3f8/fields/ HTTP/1.1" 500 301212 |
Contributor
|
I think we should rewrite following line in the PR description:
|
Contributor
|
We should perform following testing steps for all the factored out XBlocks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR:
xblocks_contrib/common→xblocks_contrib/legacy_utilsto clearly mark legacy codelegacy_utils/xml_utils.pyXModuleMixinusage and related duplicated logic fromxblocks-contribXModuleToXBlockMixininto individual XBlocksXmlMixinand movesparse_xmlinto the Problem blockRawMixin, keeping only required functionality in the Problem blockcommonfolder tolegacy_utilsfor the clarity #227